package tests;

import static org.junit.Assert.*;
import gameUtils.Coordinate;
import gameUtils.GameMath;

public class Test {

	@org.junit.Test
	public void testConstructor() {
		Coordinate c1 = new Coordinate();
		assertEquals(0, c1.getAbcissa());
		assertEquals(0, c1.getOrdinate());
		
		Coordinate c2 = new Coordinate(3, 6);
		assertEquals(3, c2.getAbcissa());
		assertEquals(6, c2.getOrdinate());
	}
	
	@org.junit.Test
	public void testSets() {
		Coordinate c1 = new Coordinate();
		
		c1.setAbcissa(4);
		assertEquals(4, c1.getAbcissa());
		
		
		c1.setOrdinate(9);
		assertEquals(9, c1.getOrdinate());
	}
	
	@org.junit.Test
	public void testToString() {
		Coordinate c1 = new Coordinate();
		
		assertEquals("Coordinate(0,0)", c1.toString());
	}
	
	
	@org.junit.Test
	public void testDistanceBetween() {
		// Direita
		assertEquals(1, GameMath.distanceBetween(new Coordinate(1, 1), new Coordinate(2, 1)));
		// Baixo
		assertEquals(1, GameMath.distanceBetween(new Coordinate(1, 1), new Coordinate(1, 2)));
		// Diagonal
		assertEquals(1, GameMath.distanceBetween(new Coordinate(1, 1), new Coordinate(2, 2)));
	}

}
